#!/usr/bin/env python
# encoding: utf-8  
# for sqlserver
#@author: szy
#
import sys
import os

sys.path.append('./helper')
#from ConfigReader import ConfigReader
#import InfoMonConstants
from helper.ConfigReader import ConfigReader
from helper import InfoMonConstants
#from ConnectionHelper import ConnectionHelper
from helper import ConnectionHelper
sys.path.append('./task')
#from ExecuteScripts import ExecuteScripts
#from Collector import Collector
from task import ExecuteScripts
from task.Collector import Collector

#初始化常量
def init():
    InfoMonConstants.CONfPATH = './etc/mon.cfg'
    cfg = ConfigReader(InfoMonConstants.CONfPATH)
    InfoMonConstants.HOST = cfg.get('host')
    InfoMonConstants.PORT = cfg.get('port')
    InfoMonConstants.USER = cfg.get('user')
    InfoMonConstants.PASSWORD = cfg.get('password')
    InfoMonConstants.DBNAME = cfg.get('dbname')
    InfoMonConstants.ENDPOINT = cfg.get('endpoint')
    InfoMonConstants.FALCON_CLINENT = cfg.get('falcon_client')
    InfoMonConstants.LOG_FILE = cfg.get('log_file')
    InfoMonConstants.LOG_LEVEL = cfg.get('log_level')
    InfoMonConstants.LONGTIME = cfg.get('longtime')

def Main():
    init()
    
    #执行脚本
    # exeCute = ExecuteScripts()
    # exeCute.execute()
    #数据收集
    c = Collector()
    c.collect()
    # c.run()

if __name__ == '__main__':
    Main()
